using UnityEngine;

namespace NodeCanvas.Conditions
{
	[Category("Input")]
	public class CheckKeyboardInput : ConditionTask
	{
		public enum PressTypes
		{
			KeyDown = 0,
			KeyUp = 1,
			KeyPressed = 2
		}

		public PressTypes PressType;

		public KeyCode Key = KeyCode.Space;

		protected override string info
		{
			get
			{
				return PressType.ToString() + " " + Key;
			}
		}

		protected override bool OnCheck()
		{
			if (PressType == PressTypes.KeyDown)
			{
				return Input.GetKeyDown(Key);
			}
			if (PressType == PressTypes.KeyUp)
			{
				return Input.GetKeyUp(Key);
			}
			if (PressType == PressTypes.KeyPressed)
			{
				return Input.GetKey(Key);
			}
			return false;
		}
	}
}
